function pay_add() {
	$("#light1").css("display", "block");
	$("#fade1").css("display", "block");
	setInterval("disptime()", 1000);
	$.ajax({
		type : "GET",
		url : "getDate",
		dataType : "json",
		success : function(data) {
			if (data != null) {
				var date = new Date(data.sl_registration);// 时间戳为10位需*1000，时间戳为13位的话不需乘1000
				Y = date.getFullYear() + '年';
				M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1)
						: date.getMonth() + 1)
						+ '月';
				D = date.getDate() + '日 ';
				h = date.getHours() + '时';
				m = date.getMinutes() + '分';
				s = date.getSeconds() + '秒';
				$("#span_Pay_Date").html(Y + M + D + h + m + s);
				$("#span_Pay_TotalNumber").html(data.countNum);
				$("#span_Send_Pay_TotalMoney").html(data.totalMoney);
			}
		}
	});
	$('#table_pay').bootstrapTable(
			{
				method : "POST",
				url : "getSentPayList.json",
				striped : true,
				singleSelect : false,
				dataType : "json",
				search : false, // 显示搜索框
				contentType : "application/x-www-form-urlencoded",
				columns : [
						{
							title : "I级机构名称",
							field : 'oz_department',
							align : 'center',
							valign : 'middle',

						},
						{
							visible : false,
							field : 'oz_departmentId',
							align : 'center',
							valign : 'middle'
						},
						{
							title : 'II级机构名称',
							field : 'p_classname',
							align : 'center',
							valign : 'middle'
						},
						{
							title : '人数',
							field : 'countPersonnelfile_id',
							align : 'center',

						},
						{
							title : '已录入人数',
							field : 'countRegister',
							align : 'center',
							valign : 'middle'

						},
						{
							title : '操作',
							field : '',
							align : 'center',
							formatter : function(value, row) {
								var detail = '<a href="#" onclick="detail(\''
										+ row.oz_departmentId
										+ '\')">录入工资发放单</a> '
								if (row.countRegister == 0) {
									return detail;
								}
							}
						}

				],
				onEditableSave : function(field, row, oldValue, $el) {
					var rows = {
						index : esIndex, // 更新列所在行的索引
						field : "sl_reality", // 要更新列的field
						value : row.em_basemoney + row.em_mealmaoney
								+ row.em_housingmoney
								+ parseFloat(row.sl_bonus)
								+ parseFloat(row.sl_traffic)
								+ parseFloat(row.sl_communication)
								+ parseFloat(row.sl_evection)
								+ parseFloat(row.sl_overtime)
								+ parseFloat(row.sl_else)
								- parseFloat(row.sl_deduct) // 要更新列的数据
					}// 更新表格数据
					$('#table_pay').bootstrapTable("updateCell", rows);
				}

			});
}
function disptime() {
	var Time = new Date();
	// 获取当前时间的年、月、日、时、分、秒
	var Years = Time.getFullYear();
	var Months = Time.getMonth() + 1;
	var Days = Time.getDate();
	var hours = Time.getHours();
	var Minutes = Time.getMinutes();
	var secods = Time.getSeconds();
	var str = Years + "年" + Months + "月" + Days + "日" + hours + "时" + Minutes
			+ "分" + secods + "秒"
	document.getElementById("span_Today").innerHTML = str;
}

function detail(oz_departmentId) {
	var oz_de = oz_departmentId;
	$.ajax({
		type : "GET",
		url : "addPs_Wage?oz_de="+oz_de,
		dataType : "json",
		success : function(data) {
			if (data.result == true) {
				alert("录入成功！")
				$('#table_pay').bootstrapTable("load", data.ps);
			}
		}
	});

}
